package com.scofevil.util;

import java.util.*;

public class IntegerRandomNumberGenerator implements
		RandomNumberGenerator<Integer> {

	private Random rand;
	private static final int defaultCount = 100;

	public IntegerRandomNumberGenerator() {
		this.rand = new Random();
	}

	@Override
	public Integer[] generate(Integer count) {
		return generateAccordingToCount(count);
	}

	@Override
	public Integer[] generate() {
		return generateAccordingToCount(defaultCount);
	}

	private Integer[] generateAccordingToCount(int count) {
		Integer[] result = new Integer[count];
		for (int i = 0; i < count; i++) {
			result[i] = rand.nextInt(count);
		}
		return result;
	}

	@Override
	public void printGeneratedNumers(Integer[] numberArray) {
		for (Integer integer : numberArray) {
			System.out.println(integer);
		}
	}
	public static void main(String[] args) {
		IntegerRandomNumberGenerator gen = new IntegerRandomNumberGenerator();
		gen.printGeneratedNumers(gen.generate());
	}

}
